<?php
/*------------------------------------------
* @AUTHOR: TANDAT @EMAIL:tidusvn05@gmail.com
* @PHONE: +84933731173
* -----------------------------------------*/
//set error report
use phpcassa\Schema\StrategyClass;

error_reporting(E_ALL|E_STRICT);
ini_set('display_errors','on');
date_default_timezone_set('Asia/Bangkok');

//set include path
set_include_path('.' . PATH_SEPARATOR . './library/' . PATH_SEPARATOR . './application/models' . PATH_SEPARATOR . './application/modules' . PATH_SEPARATOR . './application/layouts' . PATH_SEPARATOR . './application/common' . PATH_SEPARATOR . get_include_path());

//config php cassandra autoload
require_once ('autoload.php');


//include Loader file
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('D_');
$autoloader->setFallbackAutoloader(true);



Zend_Session::start();

$config = new Zend_Config_Ini('./application/configs/config.ini', 'development');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);

// init db cassandra
//D_Cassandra_Abstract::factory($config->db);
// init db mysql
$db = Zend_Db::factory($config->db);
$db->getProfiler()->setEnabled(true);
Zend_Db_Table::setDefaultAdapter($db);

//ROOT_URL
defined('ROOT_URL')||define('ROOT_URL',$config->rooturl);

//config logger
$writer = new Zend_Log_Writer_Stream('./log/development.txt');
$logger = new Zend_Log($writer);
Zend_Registry::set('logger', $logger);


$layout=Zend_Layout::startMvc(array('layoutPath' => './application/layouts'));
$layout->getView()->addHelperPath('D/Helper', 'D_Helper');

$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(array('default' => './application/controllers'));


$front->throwExceptions(true);
$front->dispatch();


